<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>房型
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="type_name" name="username" required="" lay-verify="required"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>价格
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="price" name="username" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>押金
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="deposit" name="username" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red"></span>小时价格
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hour" name="username" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
<!--                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>类型</label>
                        <div class="layui-input-inline">
                            <select name="shipping" class="valid" id="type">

                                <option value="1">全天房</option>
                                <option value="2">钟点1小时</option>
                                <option value="3">钟点2小时</option>
                                <option value="4">钟点3小时</option>
                                <option value="5">钟点4小时</option>

                            </select>
                        </div>
                    </div>-->

                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" type="button" onclick="adds()">
                          增加
                      </button>
                  </div>
              </form>
            </div>
        </div>

    </body>
<script>
    layui.use(['form', 'layer'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
        });

    function adds(){
        $.ajax({
            type:"post",
            url: "{:url('index/layouts/adds')}",
            data: {
                type_name:$('#type_name').val(),
                price:$('#price').val(),
                deposit:$('#deposit').val(),
                hour:$('#hour').val(),
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>

</html>
